﻿using System;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Entity;
using System.Data.Objects;
using System.Collections.Generic;

using PowerSys.Model;
using PowerSys.SystemFramework.AOP;

namespace PowerSys.DataAccess
{
    public class XSerialDA : AccessBase
    {
        public static string GetNew(string serialCode)
        {
            int result = 0;
            ObjectParameter code = new ObjectParameter("prm_ResultCode", typeof(decimal));
            ObjectParameter text = new ObjectParameter("prm_ResultText", "");
            ObjectParameter serial  = new ObjectParameter("prm_Serial", "");
            using (XBase xb = new XBase())
            {
                result = xb.GetSerial(serialCode, code, text, serial);
            }

            return result > 0 ? serial.Value.ToString() : "";
        }

        protected override string EntitySetName
        {
            get { return Context.X_Serial.EntitySet.Name; }
        }
    }
}
